package com.machine.action.order;

import javax.annotation.Resource;

import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;

import com.machine.bean.OrderForm;
import com.machine.service.order.OrderServer;
import com.opensymphony.xwork2.ActionSupport;


@Component("updateOrderAction")
@Scope(value = "prototype")
public class UpdateOrderAction extends ActionSupport {

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;

	private OrderServer orderServer;
	private OrderForm orderForm;
	
	private Integer id;

	public Integer getId() {
		return id;
	}

	public void setId(Integer id) {
		this.id = id;
	}

	public OrderServer getOrderServer() {
		return orderServer;
	}

	@Resource
	public void setOrderServer(OrderServer orderServer) {
		this.orderServer = orderServer;
	}

	public OrderForm getOrderForm() {
		return orderForm;
	}

	public void setOrderForm(OrderForm orderForm) {
		this.orderForm = orderForm;
	}

	@Override
	public String execute() throws Exception {
		System.out.println("update id : " + id);

		orderForm = orderServer.findById(id);
		return SUCCESS;
	}

}
